<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>课程留言板管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">

        function page(n, s) {
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            $("#searchForm").submit();
            return false;
        }

     /*   $(function(){
            setTimeout(function(){
                $("#searchForm").submit();
            },10000)
        })*/
     //刚进页面的时候 按钮是灰色的
            $(function () {
                var ymls =$("#yml").val();
                   if(ymls==5){
                        // 设置查询全部的下拉框 被选中
                    $("#all").attr("selected",true);
                    }
                // 先要获取到状态框的值 是根据值来进行判断的
                var sta=$("#status").val();
               /* alert(sta);*/
                if(sta==0){
                    $("#shuaxin").attr("disabled",true);
                }else{
                    $("#shuaxin").attr("disabled",false);
                    shuaxin();
                }
                if(sta==""){
                    $("#shuaxin").attr("disabled",false);
                    shuaxin();
                }
                if(sta==null){
                    $("#shuaxin").attr("disabled",false);
                    shuaxin();
                }
            });
        function shuaxin(){
            setTimeout(function(){
                $("#searchForm").submit();
            },10000)
        }
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li class="active"><a href="${ctx}/business/messageboard/">课程留言板列表</a></li>
    <shiro:hasPermission name="business:messageboard:edit">
        <li><a href="${ctx}/business/messageboard/form?sort=10">课程留言板添加</a></li>
    </shiro:hasPermission>
</ul>
<form:form id="searchForm" modelAttribute="messageBoard"
           action="${ctx}/business/messageboard/" method="post" class="breadcrumb form-search">
    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
    <input type="hidden" id="yml" value="${all}">
    <label>状态 ：</label>
    <form:select path="status" name="status" id="status" class="input-medium">
        <form:option value="" label="请选择"/>
        <form:option value="all" label="查看全部" id="all"/>
        <form:options items="${dic:getBusDictList('messageBoard_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
    </form:select>
    &nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit"
    value="查询" />
    <input type="button" value="自动刷新" id="shuaxin" style="float:right" class="btn btn-primary">
</form:form>
<tags:message content="${message}"/>
<table id="contentTable" class="table table-striped table-bordered table-condensed">
    <thead>
    <tr>
        <th>ID</th>
        <th>学生ID</th>
        <th>留言时间</th>
        <th>留言内容</th>
        <th>点赞人数</th>
        <th>回复内容</th>
        <th>回复时间</th>
        <th>状态</th>
        <th>推荐</th>
        <th>类型</th>
        <th>课程ID</th>

        <th>回复老师ID</th>
        <shiro:hasPermission name="business:messageboard:edit">
            <th>操作</th>
        </shiro:hasPermission>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${page.list}" var="messageBoard">
        <tr id="${messageBoard.id}">
            <td><a href="${ctx}/business/messageboard/form?id=${messageBoard.id}">${messageBoard.id}</a></td>
            <td>${messageBoard.student.name}</td>
            <td>${messageBoard.addTime}</td>
            <td>${messageBoard.content}</td>
            <td>${messageBoard.likeNumber}</td>
            <td>${messageBoard.reply}</td>
            <td>${messageBoard.replyTime}</td>
            <td>${dic:getLabelByValue(messageBoard.status,"messageBoard_status")}</td>
            <td>${dic:getLabelByValue(messageBoard.recommend,"messageBoard_recommend")}</td>
            <td>${dic:getLabelByValue(messageBoard.type,"messageBoard_type")}</td>
            <td><a href="${ctx}/business/course/form?id=${messageBoard.course.id}">${messageBoard.course.title}</a></td>

            <td>${messageBoard.teacher.name}</td>
            <shiro:hasPermission name="business:messageboard:edit">
                <td>
                    <a href="${ctx}/business/messageboard/form?id=${messageBoard.id}">回复</a>
                </td>
            </shiro:hasPermission>
        </tr>
    </c:forEach>
    </tbody>
</table>
<div class="pagination">${page}</div>
</body>
</html>